package Alarms;

public class SimulationAlarm extends AbstractAlarm {
	private int simulationEventId = 100;
	private String simulationNormalMessage;
	private String simulationEmergencyMessage;	
	
	public SimulationAlarm(String name, int Xpos, int Ypos, int mwWidth, String alarmId, String simulationNormalMessage, String simulationEmergencyMessage, int subSystemHaltEnvId, String sensor_name) {
		super(name, Xpos, Ypos, mwWidth, subSystemHaltEnvId, sensor_name);
		
		this.name = name;
		this.alarmId = alarmId;
		this.simulationNormalMessage = simulationNormalMessage;
		this.simulationEmergencyMessage = simulationEmergencyMessage;
	}

	@Override
	protected void customEventHandler() {
		if (isArmed() && (Evt.GetEventId() == simulationEventId) && (Evt.GetMessage().equals(simulationNormalMessage)))
		{
	    	mw.WriteMessage("\n\nSetting simulated NORMAL status\n");
			status = 1;
			postNormality();
		} // if

		if (isArmed() && (Evt.GetEventId() == simulationEventId) && (Evt.GetMessage().equals(simulationEmergencyMessage)))
		{
	    	mw.WriteMessage("\n\nSetting simulated EMERGENCY status\n");
			status = 2;
			postEmergency();
		} // if
		
	}

	@Override
	protected void dispose() {

	}

	@Override
	protected void customHalt() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void beforeLooping() {
		// TODO Auto-generated method stub
		
	}
}
